package chapter05

object Test07_Practice_CollectionOperation {
  def main(args: Array[String]): Unit = {
    val arr: Array[Int] = Array(12, 45, 89, 36)

    //对数组进行处理,将操作抽象出来
    def arrayOperation(array: Array[Int], op: Int => Int): Array[Int] = for (elem <- array) yield op(elem)

    val newArray = arrayOperation(arr, a => a + 1)
    println(newArray.mkString(","))
  }

}
